/**
 * Copyright (c) 2016-2021 by the respective copyright holders.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package com.zsmartsystems.zigbee.dongle.ember.ezsp.command;

import com.zsmartsystems.zigbee.dongle.ember.ezsp.EzspFrameResponse;
import com.zsmartsystems.zigbee.dongle.ember.ezsp.structure.EmberBeaconData;
import com.zsmartsystems.zigbee.dongle.ember.ezsp.structure.EmberStatus;

/**
 * Class to implement the Ember EZSP command <b>getNextBeacon</b>.
 * <p>
 * Returns the next beacon in the cache. Beacons are stored in cache after issuing an active
 * scan.
 * <p>
 * This class provides methods for processing EZSP commands.
 * <p>
 * Note that this code is autogenerated. Manual changes may be overwritten.
 *
 * @author Chris Jackson - Initial contribution of Java code generator
 */
public class EzspGetNextBeaconResponse extends EzspFrameResponse {
    public static final int FRAME_ID = 0x3D;

    /**
     * EMBER_SUCCESS if next beacon found, EMBER_BAD_ARGUMENT if input parameters are invalid,
     * EMBER_ERR_FATAL if no next beacon found.
     * <p>
     * EZSP type is <i>EmberStatus</i> - Java type is {@link EmberStatus}
     */
    private EmberStatus status;

    /**
     * The next beacon retrieved. It is assumed that emberGetFirstBeacon has been called first.
     * This argument must not be NULL.
     * <p>
     * EZSP type is <i>EmberBeaconData</i> - Java type is {@link EmberBeaconData}
     */
    private EmberBeaconData beacon;

    /**
     * Response and Handler constructor
     */
    public EzspGetNextBeaconResponse(int[] inputBuffer) {
        // Super creates deserializer and reads header fields
        super(inputBuffer);

        // Deserialize the fields
        status = deserializer.deserializeEmberStatus();
        beacon = deserializer.deserializeEmberBeaconData();
    }

    /**
     * EMBER_SUCCESS if next beacon found, EMBER_BAD_ARGUMENT if input parameters are invalid,
     * EMBER_ERR_FATAL if no next beacon found.
     * <p>
     * EZSP type is <i>EmberStatus</i> - Java type is {@link EmberStatus}
     *
     * @return the current status as {@link EmberStatus}
     */
    public EmberStatus getStatus() {
        return status;
    }

    /**
     * EMBER_SUCCESS if next beacon found, EMBER_BAD_ARGUMENT if input parameters are invalid,
     * EMBER_ERR_FATAL if no next beacon found.
     *
     * @param status the status to set as {@link EmberStatus}
     */
    public void setStatus(EmberStatus status) {
        this.status = status;
    }

    /**
     * The next beacon retrieved. It is assumed that emberGetFirstBeacon has been called first.
     * This argument must not be NULL.
     * <p>
     * EZSP type is <i>EmberBeaconData</i> - Java type is {@link EmberBeaconData}
     *
     * @return the current beacon as {@link EmberBeaconData}
     */
    public EmberBeaconData getBeacon() {
        return beacon;
    }

    /**
     * The next beacon retrieved. It is assumed that emberGetFirstBeacon has been called first.
     * This argument must not be NULL.
     *
     * @param beacon the beacon to set as {@link EmberBeaconData}
     */
    public void setBeacon(EmberBeaconData beacon) {
        this.beacon = beacon;
    }

    @Override
    public String toString() {
        final StringBuilder builder = new StringBuilder(103);
        builder.append("EzspGetNextBeaconResponse [networkId=");
        builder.append(networkId);
        builder.append(", status=");
        builder.append(status);
        builder.append(", beacon=");
        builder.append(beacon);
        builder.append(']');
        return builder.toString();
    }
}
